<extend name="Public/base"/>
<block name="content">
<h3 class="col-md-8">用户管理</h3>
<div class="col-md-4">
	<div class="input-group mb-lg">
    	<input type="text" name="nickname" class="form-control" value="<{:I('nickname')}>"  placeholder="请输入用户昵称或用户ID"></label>
    	<span class="input-group-addon">
        	<a class="fa-search fa" href="javascript:void(0);"></a>
    	</span>
	</div>
</div>
<div class="row">
    <div class="col-lg-12">
    	<div class="panel panel-default">
       		<div class="panel-heading ">用户列表
       			<div class="btn-group pull-right">
	       			<a class="btn btn-labeled btn-success" href="<{:U('add')}>">新增</a> 
	                <a class="btn btn-labeled btn-danger ajax-post" url="<{:U('User/changeStatus',array('method'=>'deleteUser'))}>" target-form="ids">删除</a>
					<a class="btn btn-labeled btn-success ajax-post" url="<{:U('User/changeStatus',array('method'=>'resumeUser'))}>" target-form="ids">启用</a>
            		<a class="btn btn-labeled btn-danger ajax-post" url="<{:U('User/changeStatus',array('method'=>'forbidUser'))}>" target-form="ids">禁用</a>
	         	</div>      			
       		</div>
    		<div class="table-responsive">
        		<table class="table table-striped table-bordered table-hover">      
                    <thead>
                      <tr>
                        <th style="width: 5%" class="check-all">
                        	<div data-toggle="tooltip" data-title="全选" class="checkbox c-checkbox">
                         		<label>
                            		<input type="checkbox">
                            		<span class="fa fa-check"></span>
                         		</label>
                      		</div>
                        </th>
         				<th>UID</th>
        				<th>昵称</th>
        				<th>积分</th>
        				<th>登录次数</th>
        				<th>最后登录时间</th>
        				<th>最后登录IP</th>
        				<th>状态</th>
        				<th class='text-center'>操作</th>
                      </tr>
                    </thead>
                    <tbody role="alert" aria-live="polite" aria-relevant="all">
        				<notempty name="_list">
        				<volist name="_list" id="vo">
        				<tr>
                   		 	<td>
                      			<div class="checkbox c-checkbox">
                         			<label>
                            		<input type="checkbox" class="ids" value="<{$vo.uid}>" name="id[]">
                            		<span class="fa fa-check"></span>
                         			</label>
                      			</div>
                   			</td>
        					<td><{$vo.uid}> </td>
        					<td><{$vo.nickname}></td>
        					<td><{$vo.score}></td>
        					<td><{$vo.login}></td>
        					<td><span><{$vo.last_login_time|time_format}></span></td>
        					<td><span><{:long2ip($vo['last_login_ip'])}></span></td>
        					<td><{$vo.status_text}></td>
        					<td class='text-center'><eq name="vo.status" value="1">
        						<a href="<{:U('User/changeStatus?method=forbidUser&id='.$vo['uid'])}>" class="btn btn-labeled btn-danger btn-sm ajax-get">禁用</a>
        						<else/>
        						<a href="<{:U('User/changeStatus?method=resumeUser&id='.$vo['uid'])}>" class="btn btn-labeled btn-success btn-sm ajax-get">启用</a>
        						</eq>
        						<a href="<{:U('AuthManager/group?uid='.$vo['uid'])}>" class="btn btn-labeled btn-success btn-sm">授权</a>
        						<a href="<{:U('User/changeStatus?method=deleteUser&id='.$vo['uid'])}>" class="btn btn-labeled btn-danger btn-sm ajax-get">删除</a>
                        	</td>
        				</tr>
        				</volist>
        				<else/>
        				<td colspan="9" class="text-center">暂时还没有内容! </td>
        				</notempty>
                    </tbody>
                </table>
     		</div>
    		<!-- 结束 表格 -->
    		<div class="panel-footer">
				<div class="row">
					<div class="pagination">
					<{$_page}>
					</div>
				</div>
            </div>    		
    	</div>
	</div>
</div>
</block>
<block name="script">
<script type="text/javascript">
	//搜索功能
	$("#search").click(function(){
		var url = $(this).attr('url');
        var query  = $('.search-form').find('input').serialize();
        query = query.replace(/(&|^)(\w*?\d*?\-*?_*?)*?=?((?=&)|(?=$))/g,'');
        query = query.replace(/^&/g,'');
        if( url.indexOf('?')>0 ){
            url += '&' + query;
        }else{
            url += '?' + query;
        }
		window.location.href = url;
	});
	//回车搜索
	$(".search-input").keyup(function(e){
		if(e.keyCode === 13){
			$("#search").click();
			return false;
		}
	});
    //导航高亮
    highlight_subnav("<{:U('User/index')}>");
	</script>
</block>



